/**
 * 路由配置项
 * Created by 天上云好白 on 2016/12/29.
 */
import util from './util'

import Login from './view/Login.vue'
import Home from './view/Home.vue'
import Page from './view/Page.vue'

const routes = [
  {
    path: '/',
    name: '/',
    component: Login,
    beforeEnter: (to, from, next) => {
      var user = util.Cookie.get('user')
      if (user) {
        next('/home')
      } else {
        next()
      }
    }
  },
  {
    path: '/home',
    name: 'home',
    component: Home
  },
  {
    path: '/home/page',
    name: 'page',
    component: Page
  }
]

export default routes
